home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS20.ADF
/
BobEd
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-01-27
|
4KB
|
138 lines
/**********************************************************************
*
* BobEd V1.5
* (C) 1986, Peter Philip.
* This program is free to distribute as long as the following
* conditions are met : 1) You do not make a profit from it.
* 2) This notice is not removed.
* Simple eh? :-)
*
* BobEd V1.0 consists of the following source files :
* main.c, events.c, drawbox.c, gadgets.c,
* menus.c, disk.c, requesters.c, bobed.h
*
* The file BobEd.doc contains the instructions for this program.
*
* If you find this program really useful a small contribution
* of no more than $10 would be nice, OR if you send postage I will
* let you know when I have a greatly improved version completed.
*
* Peter Philip
* 111 Ancaster Ct.
* Dartmouth, N.S.
* B2V 1J2, CANADA
*
******************************************************************** */
#include <bobed.h>
long GfxBase,IntuitionBase;
extern doevent ();
extern drawboxes ();
extern makemenu ();
extern makegads ();
struct Window *w;
struct Screen *screen;
struct RastPort *rp;
struct ViewPort *vp;
/* gadget structure definitions */
extern struct Gadget colgad [COLORS];
/* menu structure definitions */
extern struct Menu menu [MENUS];
/* image data */
UBYTE bobdata [OBS+1][BWIDE*16][BHIGH]; /* one extra for buffer */
struct TextAttr TestFont = { "topaz.font", 8, 0, 0 };
struct NewScreen ns = {
0, 0, /* left edge, top edge */
WIDE,HIGH,DEPTH, /* width, height */
2, 1, /* detail pen, block pen */
MODE, /* viewing mode */
CUSTOMSCREEN, /* screen type */
&TestFont, /* font to use */
"BobEd V1.5", /* default title for screen */
NULL /* pointer to additional gadgets */
};
struct NewWindow nw = {
00, 00, /* left edge, top edge */
WIDE, HIGH, /* width, height */
2, 1, /* detail pen, block pen*/
MOUSEBUTTONS|MOUSEMOVE|
GADGETUP|MENUPICK, /* IDCMP flags */
SMART_REFRESH|REPORTMOUSE|
ACTIVATE|NOCAREREFRESH, /* window flags */
(struct Gadget *)&colgad[0], /* user gadgets */
NULL, /* pointer to user checkmark */
"BobEd 1.5", /* window title */
NULL, /* pointer to screen(later)*/
NULL, /* pointer to superbitmap */
0,0, /* minimum size (not used) */
WIDE,HIGH, /* max size of window (not used) */
CUSTOMSCREEN /* type of screen in which to open */
};
/* -------------------------------------------------------------------- */
main()
{
GfxBase = OpenLibrary("graphics.library",LIBRARY_VERSION);
if (GfxBase == NULL)
{
exit(1000);
}
IntuitionBase = OpenLibrary("intuition.library",LIBRARY_VERSION);
if (IntuitionBase == NULL)
{
CloseLibrary (GfxBase);
exit(1000);
}
screen = (struct Screen *)OpenScreen(&ns); /* open our custom screen */
if (screen == NULL)
{
CloseLibrary (GfxBase);
CloseLibrary (IntuitionBase);
exit (1000);
}
nw.Screen = screen; /* link to the window */
makegads (); /* initialise the gadgets */
w = (struct Window *)OpenWindow(&nw); /* open our window */
if (w == NULL)
{
CloseLibrary (GfxBase);
CloseLibrary (IntuitionBase);
CloseScreen (screen);
exit (1000);
}
makemenu (); /* initialise the menus */
SetMenuStrip (w,&menu[0]);
initdiskreq (); /* initialise the requesters */
rp = w->RPort; /* get address of rastport */
vp = &w->WScreen->ViewPort; /* and viewport */
drawboxes (); /* draw the image boxes */
doevent (); /* process events forever */
}
VOID bye () /* exits program closing all resources allocated */
{
CloseWindow (w);
CloseScreen (screen);
CloseLibrary (IntuitionBase);
CloseLibrary (GfxBase);
exit (TRUE);
}